var fs = require('fs');
//================================================================
// writeFile, 没有会新建
fs.writeFile("tmp", "Hey there!", function(err) {
    if(err) { return console.log(err); }
    console.log("The file was saved!");
});
//================================================================
// appendFile, 可以往后面添加, 没有文件会新建
fs.appendFile('tmp2', 'data to append' + '\n', function (err) {
    if (err) throw err;
    console.log('Saved!');
});
fs.appendFile('tmp2', 'data to append too' + '\n', function (err) {
    if (err) throw err;
    console.log('Saved!');
});
